﻿using System;
using Repository;
using Infrastructure;
using Models;
using System.Linq;
using SqlSugar;

namespace DataAccess
{
    public class BusinessEntityDao : GeneralRepository<BusinessEntity>, IBusinessEntity
    {

        public BusinessEntity FindById(int id)
        {
            using (var db = SugarDao.GetInstance())
            {
                return db.SqlQuery<BusinessEntity>("SELECT [BusinessEntityID],[rowguid],[ModifiedDate] FROM [Person].[BusinessEntity] WHERE BusinessEntityID = @id", new { id = id }).FirstOrDefault();
                //return db.Queryable<BusinessEntity>().SingleOrDefault(o => o.BusinessEntityID == id);
            }
        }
    }
}
